package com.zjjt.dc.modules.datacatch.service.blh.impl;

import java.util.List;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.zjjt.dc.common.query.QueryGenerator;
import com.zjjt.dc.modules.datacatch.entity.blh.DcCatchDataBlhProductInfo;
import com.zjjt.dc.modules.datacatch.mapper.IDcCatchDataBlhProductInfoMapper;
import com.zjjt.dc.modules.datacatch.service.blh.IDcCatchDataBlhProductInfoService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.stream.Collectors;

@Slf4j
@Service
public class DcCatchDataBlhProductInfoServiceImpl extends ServiceImpl<IDcCatchDataBlhProductInfoMapper, DcCatchDataBlhProductInfo> implements IDcCatchDataBlhProductInfoService {


    @Override
    public List<DcCatchDataBlhProductInfo> getCreateById(String id) {
        DcCatchDataBlhProductInfo entity = new DcCatchDataBlhProductInfo();
        entity.setCreateBy(Long.parseLong(id));
        QueryWrapper<DcCatchDataBlhProductInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("create_by", id);
        return baseMapper.selectList(queryWrapper);
    }

    @Override
    public List<Long> getIds() {
        QueryWrapper<DcCatchDataBlhProductInfo> queryWrapper = new QueryWrapper<>();
        queryWrapper.select("id")
                .orderByDesc("create_time")
                .eq("del_flag", 0);
        List<DcCatchDataBlhProductInfo> list =baseMapper.selectList(queryWrapper);
        List<Long> ids = list.stream().map(DcCatchDataBlhProductInfo::getId)
                .collect(Collectors.toList());
        return ids;
    }


}
